home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #1 / Amiga Plus CD - 1996 - No. 1.iso / pd / netz / xbtx_v1.1 / gfxdisplay.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-26  |  5.9 KB  |  181 lines

  1. /*
  2. **    $Id: GfxDisplay.hpp 1.4 1995/09/26 19:45:11 olsen Exp olsen $
  3. **
  4. **    :ts=4
  5. */
  6.  
  7. /*
  8.  * Amiga changes copyright © 1995 by Olaf Barthel, All Rights Reserved
  9.  *
  10.  * Copyright (c) 1992, 1993 Arno Augustin, Frank Hoering, University of
  11.  * Erlangen-Nuremberg, Germany.
  12.  * All rights reserved.
  13.  *
  14.  * Redistribution and use in source and binary forms, with or without
  15.  * modification, are permitted provided that the following conditions
  16.  * are met:
  17.  * 1. Redistributions of source code must retain the above copyright
  18.  *    notice, this list of conditions and the following disclaimer.
  19.  * 2. Redistributions in binary form must reproduce the above copyright
  20.  *    notice, this list of conditions and the following disclaimer in the
  21.  *    documentation and/or other materials provided with the distribution.
  22.  * 3. All advertising materials mentioning features or use of this software
  23.  *    must display the following acknowledgement:
  24.  *    This product includes software developed by the University of
  25.  *    Erlangen-Nuremberg, Germany.
  26.  * 4. Neither the name of the University nor the names of its contributors
  27.  *    may be used to endorse or promote products derived from this software
  28.  *    without specific prior written permission.
  29.  *
  30.  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  31.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  32.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
  33.  * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  34.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  35.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  36.  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  37.  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  38.  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  39.  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40.  *
  41.  * This software has not been validated by the ``Bundesamt fuer Zulassungen in
  42.  * der Telekommunikation'' of the ``Deutsche Bundepost Telekom'' and thus
  43.  * must not be used for accessing the BTX-Network of the Telekom in Germany.
  44.  *
  45.  * Diese Software hat keine Zulassung durch das Bundesamt fuer Zulassungen in
  46.  * der Telekommunikation der Deutschen Bundespost Telekom und darf daher nicht
  47.  * am Netz der Deutschen Bundespost Telekom in Deutschland betrieben werden.
  48.  */
  49.  
  50. #ifndef _GFXDISPLAY_HPP
  51. #define _GFXDISPLAY_HPP 1
  52.  
  53. #include "BTXDisplay.hpp"
  54. #include "Font.h"
  55.  
  56. /****************************************************************************/
  57.  
  58. #include <intuition/intuitionbase.h>
  59. #include <graphics/gfxbase.h>
  60. #include <exec/memory.h>
  61.  
  62. /****************************************************************************/
  63.  
  64. #define MAX_ZOOM 8
  65.  
  66. typedef struct btxchar
  67. {
  68.     struct btxchar    *link;
  69.     unsigned char    *raw;
  70.     unsigned char    bits;
  71.     struct BitMap    *map[4];
  72. } btxchar;
  73.  
  74. typedef struct colorentry
  75. {
  76.     unsigned char    red;
  77.     unsigned char    green;
  78.     unsigned char    blue;
  79. } colorentry;
  80.  
  81. class GfxDisplay : public BTXDisplay
  82. {
  83.     public:
  84.  
  85.         GfxDisplay();
  86.         ~GfxDisplay();
  87.  
  88.         LONG    Open(STRPTR PubScreenName,int XScale,int YScale,BOOL DirectRender);
  89.         VOID    Close(VOID);
  90.         VOID    MonitorData(int *btx_rows,int *btx_fontheight);
  91.         ULONG    WaitMask(VOID);
  92.         LONG    GetChar(VOID);
  93.         LONG    Waiting(VOID);
  94.         VOID    PutLine(STRPTR Line);
  95.  
  96.         void    xputc(int c,int set,int x,int y,int xdouble,int ydouble,int underline,int diacrit,int fg,int bg);
  97.         void    xclearscreen(void);
  98.         void    xcursor(int x,int y);
  99.         void    define_raw_DRC(int c,unsigned char *data,int bits);
  100.         void    define_color(int index,int r,int g,int b);
  101.         void    define_DCLUT(int entry,int index);
  102.         void    define_fullrow_bg(int row,int index);
  103.         void    free_DRCS(void);
  104.         void    default_colors(void);
  105.  
  106.     private:
  107.  
  108.         void                 xdraw_normal_char(btxchar *ch,int x,int y,int xd,int yd,int ul,btxchar *dia,int fg,int bg);
  109.         void                 xdraw_multicolor_char(btxchar *ch,int x,int y,int xd,int yd);
  110.         struct BitMap        *rawfont2bitmap(unsigned char *src,int xzoom,int yzoom);
  111.         struct BitMap        *createpixmapfromfont(unsigned char *src,int xzoom,int yzoom,int bits);
  112.         void                 init_fonts(void);
  113.         void                 free_font_pixmaps(void);
  114.         void                 store_colors(void);
  115.         void                 init_colormap(void);
  116.  
  117.         btxchar                 btx_font[6*96];
  118.         int                     fullrow_bg[24];     /* fullrow background color for eacch row */
  119.         int                     dclut[4];            /* map the 4-color DRC's */
  120.         colorentry             colormap[32+4+24];    /* store pixel value for each colorcell */
  121.         int                     cur_fg,
  122.                              cur_bg;
  123.         unsigned char         data[FONT_HEIGHT*2*2*FONT_WIDTH*2*2*MAX_ZOOM],
  124.                              row[FONT_WIDTH*2*2*MAX_ZOOM];
  125.  
  126.         int                    *rows;
  127.         int                    *fontheight;
  128.  
  129.         int                     ScaleX;
  130.         int                     ScaleY;
  131.  
  132.         WORD                 PutIndex;
  133.  
  134.         BOOL                 DirectRender;
  135.  
  136.         UBYTE                 FgBgMinterms[8];
  137.         UBYTE                 FgMinterms[8];
  138.         struct RastPort      LocalRPort;
  139.         struct BitMap         LocalBitMap;
  140.  
  141.         struct RastPort      TempRPort;
  142.  
  143.         struct Screen        *Screen;
  144.         struct Window        *Window;
  145.  
  146.         struct ViewPort     *VPort;
  147.  
  148.         struct InputEvent     Event;
  149.  
  150.         LONG                 FgPen,BgPen;
  151.  
  152.         struct MsgPort        *WindowPort;
  153.         ULONG                 WindowMask;
  154.  
  155.         WORD                 WaitingChar;
  156.  
  157.         UWORD                 DisplayWidth;
  158.         UWORD                 DisplayHeight;
  159.  
  160.         LONG                 Pen[60];
  161.         struct RastPort     *RPort;
  162.  
  163.         VOID                 PreparePaintFgBg(UBYTE Fore,UBYTE Back,UBYTE *Minterms=NULL);
  164.         VOID                 PreparePaintFg(UBYTE Fore,UBYTE *Minterms=NULL);
  165.         VOID                 DrawTemplate(CONST struct BitMap *BitMap,CONST UBYTE *Minterms,UWORD Left,UWORD Top,UWORD Width,UWORD Height);
  166.         struct BitMap        *NewBitMap(WORD Depth,WORD Width,WORD Height);
  167.         VOID                 DisposeBitMap(struct BitMap *BitMap);
  168.         VOID                 SetFgPen(LONG Index);
  169.         VOID                 SetBgPen(LONG Index);
  170.         VOID                 SetPens(LONG Fg,LONG Bg);
  171.         VOID                 Fill(LONG Left,LONG Top,LONG Width,LONG Height);
  172.         VOID                 Complement(LONG Left,LONG Top,LONG Width,LONG Height);
  173.         VOID                 SetColour(LONG Index,UBYTE Red,UBYTE Green,UBYTE Blue);
  174.         BOOL                 InitColours(VOID);
  175.         LONG                 MapKey(struct IntuiMessage *Message);
  176.         ULONG                 FindBestModeID(Tag FirstTag,...);
  177.         VOID                 ReleaseColours(VOID);
  178. };
  179.  
  180. #endif    // _GFXDISPLAY_HPP
  181.